package org.csmzxy.class2333;

public class Example26 {
    public static void saveAge(int age) throws AgeIllegalExample{
        if (age > 0 && age <150){
            System.out.println("年龄被成功保存："+age);
        }else {
            throw new AgeIllegalExample("您输入的年龄不合法！");
        }
    }
    public static void main(String[] args){
        try {
            saveAge(255);
        }catch (AgeIllegalExample e){
            System.out.println(e.getMessage());
        }
    }
}
